package sanshui.system.trade.factory.trade.strategy.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import sanshui.system.trade.factory.data.Bar;
import sanshui.system.trade.factory.trade.TradeSystemContext;
import sanshui.system.trade.factory.trade.indicator.IndicatorResult;
import sanshui.system.trade.factory.trade.strategy.AbstractStrategy;
import sanshui.system.trade.factory.trade.strategy.StrategyCallType;
import sanshui.system.trade.factory.trade.strategy.StrategyCode;
import sanshui.system.trade.factory.trade.strategy.StrategyResult;
import sanshui.system.trade.model.TradeAccountModel;

import java.util.List;
import java.util.Map;

/**
 * 默认使用A股
 * */
@Component
public class DefaultStrategy extends AbstractStrategy {
    private static final Logger logger = LoggerFactory.getLogger(DefaultStrategy.class);

    @Override
    public StrategyCode getStrategyCode() {
        return StrategyCode.DEFAULT;
    }

    /**
     * 不用操作
     */
    @Override
    public StrategyResult exec(String code, IndicatorResult indicatorResult, TradeSystemContext tradeSystemContext) {
        Bar bar = tradeSystemContext.getDataCache().getcurrentBar().get(code);

        StrategyResult strategyResult = new StrategyResult();
        strategyResult.setCode(code);
        strategyResult.setStrategyCallType(StrategyCallType.NOTHING);
        strategyResult.setNumAround(1L);
        strategyResult.setPriceAround(100L);
        // 最好是给与最新价格
        strategyResult.setPrice(bar.getClose());
        return strategyResult;
    }
}
